﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SaleOnlineSystem.Admin
{
    public partial class Index : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Account_ID"] == null)
                Response.Redirect("/Admin/Login.aspx");
            if (Request.QueryString["panel"] != null)
            {
                int id = Convert.ToInt32(Request.QueryString["panel"]);
                int sub = Convert.ToInt32(Request.QueryString["sub"]);
                if (id == 0)
                {

                    if (sub == 0)
                    {                        
                        SaleOnlineSystem.Admin.Controls.AddNewAccount gp = (SaleOnlineSystem.Admin.Controls.AddNewAccount)LoadControl("~/Admin/Controls/AddNewAccount.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 1)
                    {                       
                        SaleOnlineSystem.Admin.Controls.ListAccount gp = (SaleOnlineSystem.Admin.Controls.ListAccount)LoadControl("~/Admin/Controls/ListAccount.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 2)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewProfile gp = (SaleOnlineSystem.Admin.Controls.ViewProfile)LoadControl("~/Admin/Controls/ViewProfile.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 3)
                    {
                        SaleOnlineSystem.Admin.Controls.EditProfile gp = (SaleOnlineSystem.Admin.Controls.EditProfile)LoadControl("~/Admin/Controls/EditProfile.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 4)
                    {
                        SaleOnlineSystem.Admin.Controls.ListAccountBank gp = (SaleOnlineSystem.Admin.Controls.ListAccountBank)LoadControl("~/Admin/Controls/ListAccountBank.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 5)
                    {
                        SaleOnlineSystem.Admin.Controls.AddAccountATM gp = (SaleOnlineSystem.Admin.Controls.AddAccountATM)LoadControl("~/Admin/Controls/AddAccountATM.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 6)
                    {
                        SaleOnlineSystem.Admin.Controls.EditProfileLogin gp = (SaleOnlineSystem.Admin.Controls.EditProfileLogin)LoadControl("~/Admin/Controls/EditProfileLogin.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 7)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewEditProfileLogin gp = (SaleOnlineSystem.Admin.Controls.ViewEditProfileLogin)LoadControl("~/Admin/Controls/ViewEditProfileLogin.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 8)
                    {
                        SaleOnlineSystem.Admin.Controls.ChangePasswordLogin gp = (SaleOnlineSystem.Admin.Controls.ChangePasswordLogin)LoadControl("~/Admin/Controls/ChangePasswordLogin.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    
                }
                if (id == 1)
                {

                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.AddProduct gp = (SaleOnlineSystem.Admin.Controls.AddProduct)LoadControl("~/Admin/Controls/AddProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.ListShowProduct gp = (SaleOnlineSystem.Admin.Controls.ListShowProduct)LoadControl("~/Admin/Controls/ListShowProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 2)
                    {
                        SaleOnlineSystem.Admin.Controls.Vendor gp = (SaleOnlineSystem.Admin.Controls.Vendor)LoadControl("~/Admin/Controls/Vendor.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 3)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewDetailVendor gp = (SaleOnlineSystem.Admin.Controls.ViewDetailVendor)LoadControl("~/Admin/Controls/ViewDetailVendor.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 4)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewProduct gp = (SaleOnlineSystem.Admin.Controls.ViewProduct)LoadControl("~/Admin/Controls/ViewProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 5)
                    {
                        SaleOnlineSystem.Admin.Controls.EditProduct gp = (SaleOnlineSystem.Admin.Controls.EditProduct)LoadControl("~/Admin/Controls/EditProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 6)
                    {
                        SaleOnlineSystem.Admin.Controls.EditVendor gp = (SaleOnlineSystem.Admin.Controls.EditVendor)LoadControl("~/Admin/Controls/EditVendor.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 7)
                    {
                        SaleOnlineSystem.Admin.Controls.ListColorAndSize gp = (SaleOnlineSystem.Admin.Controls.ListColorAndSize)LoadControl("~/Admin/Controls/ListColorAndSize.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 8)
                    {
                        SaleOnlineSystem.Admin.Controls.AddVendor gp = (SaleOnlineSystem.Admin.Controls.AddVendor)LoadControl("~/Admin/Controls/AddVendor.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 9)
                    {
                        SaleOnlineSystem.Admin.Controls.EditImageProduct gp = (SaleOnlineSystem.Admin.Controls.EditImageProduct)LoadControl("~/Admin/Controls/EditImageProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 10)
                    {
                        SaleOnlineSystem.Admin.Controls.EditSize gp = (SaleOnlineSystem.Admin.Controls.EditSize)LoadControl("~/Admin/Controls/EditSize.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 11)
                    {
                        SaleOnlineSystem.Admin.Controls.AddColorProduct gp = (SaleOnlineSystem.Admin.Controls.AddColorProduct)LoadControl("~/Admin/Controls/AddColorProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                }

                if (id == 2)
                {
                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.Category gp = (SaleOnlineSystem.Admin.Controls.Category)LoadControl("~/Admin/Controls/Category.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.AddCategory gp = (SaleOnlineSystem.Admin.Controls.AddCategory)LoadControl("~/Admin/Controls/AddCategory.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 3)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewDetailCategory gp = (SaleOnlineSystem.Admin.Controls.ViewDetailCategory)LoadControl("~/Admin/Controls/ViewDetailCategory.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 2)
                    {
                        SaleOnlineSystem.Admin.Controls.EditCategory gp = (SaleOnlineSystem.Admin.Controls.EditCategory)LoadControl("~/Admin/Controls/EditCategory.ascx");

                        mycontent.Controls.Add(gp);
                       
                    }
                   
                }
                if (id == 3)
                {

                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.ListOrder gp = (SaleOnlineSystem.Admin.Controls.ListOrder)LoadControl("~/Admin/Controls/ListOrder.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewOrder gp = (SaleOnlineSystem.Admin.Controls.ViewOrder)LoadControl("~/Admin/Controls/ViewOrder.ascx");

                        mycontent.Controls.Add(gp);
                    }
                }
                if (id == 4)
                {

                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.ListEmail gp = (SaleOnlineSystem.Admin.Controls.ListEmail)LoadControl("~/Admin/Controls/ListEmail.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.ListContact gp = (SaleOnlineSystem.Admin.Controls.ListContact)LoadControl("~/Admin/Controls/ListContact.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 2)
                    {
                        SaleOnlineSystem.Admin.Controls.ListComment gp = (SaleOnlineSystem.Admin.Controls.ListComment)LoadControl("~/Admin/Controls/ListComment.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 3)
                    {
                        SaleOnlineSystem.Admin.Controls.ListEmployee gp = (SaleOnlineSystem.Admin.Controls.ListEmployee)LoadControl("~/Admin/Controls/ListEmployee.ascx");

                        mycontent.Controls.Add(gp);
                    }
                }
                if (id == 5)
                {
                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.ListSlideShow gp = (SaleOnlineSystem.Admin.Controls.ListSlideShow)LoadControl("~/Admin/Controls/ListSlideShow.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.EditSlideShow gp = (SaleOnlineSystem.Admin.Controls.EditSlideShow)LoadControl("~/Admin/Controls/EditSlideShow.ascx");

                        mycontent.Controls.Add(gp);
                    }               
                    if (sub == 3)
                    {
                        SaleOnlineSystem.Admin.Controls.AddSlideShow gp = (SaleOnlineSystem.Admin.Controls.AddSlideShow)LoadControl("~/Admin/Controls/AddSlideShow.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 4)
                    {
                        SaleOnlineSystem.Admin.Controls.ListPoster gp = (SaleOnlineSystem.Admin.Controls.ListPoster)LoadControl("~/Admin/Controls/ListPoster.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 5)
                    {
                        SaleOnlineSystem.Admin.Controls.EditPoster gp = (SaleOnlineSystem.Admin.Controls.EditPoster)LoadControl("~/Admin/Controls/EditPoster.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 6)
                    {
                        SaleOnlineSystem.Admin.Controls.AddPoster gp = (SaleOnlineSystem.Admin.Controls.AddPoster)LoadControl("~/Admin/Controls/AddPoster.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 7)
                    {
                        SaleOnlineSystem.Admin.Controls.ListBoxProduct gp = (SaleOnlineSystem.Admin.Controls.ListBoxProduct)LoadControl("~/Admin/Controls/ListBoxProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 8)
                    {
                        SaleOnlineSystem.Admin.Controls.EditBoxProduct gp = (SaleOnlineSystem.Admin.Controls.EditBoxProduct)LoadControl("~/Admin/Controls/EditBoxProduct.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 9)
                    {
                        SaleOnlineSystem.Admin.Controls.ListImageAds gp = (SaleOnlineSystem.Admin.Controls.ListImageAds)LoadControl("~/Admin/Controls/ListImageAds.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 10)
                    {
                        SaleOnlineSystem.Admin.Controls.EditImageAds gp = (SaleOnlineSystem.Admin.Controls.EditImageAds)LoadControl("~/Admin/Controls/EditImageAds.ascx");

                        mycontent.Controls.Add(gp);
                    }  
                    
                }
                if (id == 6)
                {
                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.Chart gp = (SaleOnlineSystem.Admin.Controls.Chart)LoadControl("~/Admin/Controls/Chart.ascx");

                        mycontent.Controls.Add(gp);
                    }

                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.ListNote gp = (SaleOnlineSystem.Admin.Controls.ListNote)LoadControl("~/Admin/Controls/ListNote.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 2)
                    {
                        SaleOnlineSystem.Admin.Controls.Notification gp = (SaleOnlineSystem.Admin.Controls.Notification)LoadControl("~/Admin/Controls/Notification.ascx");

                        mycontent.Controls.Add(gp);
                    }

                }
                if (id == 7)
                {
                    if (sub == 0)
                    {
                        SaleOnlineSystem.Admin.Controls.ListLogo gp = (SaleOnlineSystem.Admin.Controls.ListLogo)LoadControl("~/Admin/Controls/ListLogo.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 1)
                    {
                        SaleOnlineSystem.Admin.Controls.EditLogo gp = (SaleOnlineSystem.Admin.Controls.EditLogo)LoadControl("~/Admin/Controls/EditLogo.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 2)
                    {
                        SaleOnlineSystem.Admin.Controls.ListHelpOnline gp = (SaleOnlineSystem.Admin.Controls.ListHelpOnline)LoadControl("~/Admin/Controls/ListHelpOnline.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 3)
                    {
                        SaleOnlineSystem.Admin.Controls.AddYahooOnline gp = (SaleOnlineSystem.Admin.Controls.AddYahooOnline)LoadControl("~/Admin/Controls/AddYahooOnline.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 4)
                    {
                        SaleOnlineSystem.Admin.Controls.ListHuongdan gp = (SaleOnlineSystem.Admin.Controls.ListHuongdan)LoadControl("~/Admin/Controls/ListHuongdan.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 5)
                    {
                        SaleOnlineSystem.Admin.Controls.EditHuongdan gp = (SaleOnlineSystem.Admin.Controls.EditHuongdan)LoadControl("~/Admin/Controls/EditHuongdan.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 6)
                    {
                        SaleOnlineSystem.Admin.Controls.ListAddressFooter gp = (SaleOnlineSystem.Admin.Controls.ListAddressFooter)LoadControl("~/Admin/Controls/ListAddressFooter.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 7)
                    {
                        SaleOnlineSystem.Admin.Controls.EditAddressFooter gp = (SaleOnlineSystem.Admin.Controls.EditAddressFooter)LoadControl("~/Admin/Controls/EditAddressFooter.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 8)
                    {
                        SaleOnlineSystem.Admin.Controls.ListVideo gp = (SaleOnlineSystem.Admin.Controls.ListVideo)LoadControl("~/Admin/Controls/ListVideo.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 9)
                    {
                        SaleOnlineSystem.Admin.Controls.EditVideo gp = (SaleOnlineSystem.Admin.Controls.EditVideo)LoadControl("~/Admin/Controls/EditVideo.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 10)
                    {
                        SaleOnlineSystem.Admin.Controls.ListNews gp = (SaleOnlineSystem.Admin.Controls.ListNews)LoadControl("~/Admin/Controls/ListNews.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 11)
                    {
                        SaleOnlineSystem.Admin.Controls.EditNews gp = (SaleOnlineSystem.Admin.Controls.EditNews)LoadControl("~/Admin/Controls/EditNews.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 12)
                    {
                        SaleOnlineSystem.Admin.Controls.AddNews gp = (SaleOnlineSystem.Admin.Controls.AddNews)LoadControl("~/Admin/Controls/AddNews.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 13)
                    {
                        SaleOnlineSystem.Admin.Controls.ViewDetailNews gp = (SaleOnlineSystem.Admin.Controls.ViewDetailNews)LoadControl("~/Admin/Controls/ViewDetailNews.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 14)
                    {
                        SaleOnlineSystem.Admin.Controls.ListHeader gp = (SaleOnlineSystem.Admin.Controls.ListHeader)LoadControl("~/Admin/Controls/ListHeader.ascx");

                        mycontent.Controls.Add(gp);
                    }
                    if (sub == 15)
                    {
                        SaleOnlineSystem.Admin.Controls.EditHeader gp = (SaleOnlineSystem.Admin.Controls.EditHeader)LoadControl("~/Admin/Controls/EditHeader.ascx");

                        mycontent.Controls.Add(gp);
                    }
                }
            }
            else
            {
                SaleOnlineSystem.Admin.Controls.Main gp = (SaleOnlineSystem.Admin.Controls.Main)LoadControl("~/Admin/Controls/Main.ascx");

                mycontent.Controls.Add(gp);
            }
        }
    }
}